<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Polldaddy Helper for WebMatrix</title>
    <link href="content/Site.css" rel="stylesheet" />
</head>
<body>
    <div class="container">
        <div class="header">
            <img src="content/images/webx-icon.png" alt="WebMatrix Logo" class="webMatrixLogo" />
            <img src="content/images/polldaddy-logo.png" alt="Polldaddy Logo" class="partnerLogo" />
            <h1>
                Microsoft WebMatrix Helpers</h1>
            <h2>
                Polldaddy Helper - Start Here</h2>
        </div>
        <div class="content">
            <div class="navLinks">
                <a href="startHere.htm">Start Here</a> | <a href="reference.htm">Helper Reference</a>
            </div>
            <h3>
                Introduction</h3>
            <p>
                Microsoft WebMatrix provides an easy way to get started with web development, and
                together with new Razor syntax for ASP.NET Web Pages it includes everything you
                need to get your web site up, running and integrated with many other sites and networks,
                in a short period of time. The WebMatrix helpers are designed to make your life
                easier when creating web sites. They provide you a simple and consistent way of
                performing common web development tasks that otherwise would require a great deal
                of custom coding. With a few lines of code you should be able to secure your web
                site using membership, store information in Windows Azure Storage, integrate your
                site with Facebook, among others things.
            </p>
            <p>
                The <strong>Polldaddy</strong> helper makes it easy to add Poll widgets, ratings and surveys to your WebMatrix site in a few lines of code. 
                It also provides access to the Polldaddy API, wrapping some of the API methods to retrieve Poll data.
            </p>
            <img src="content/images/polldaddy-helper.png" height="250" class="centeredImage"
                alt="Polldaddy Helper" />
            <p>
                Depending on the helper feature you want to use, the helper requires that you call an initialization method. Check the reference page to check each case. For using
                helper methods without initialization see the <strong>Getting Started in 60 seconds (without initialization)</strong> section, otherwise see the <strong>Getting Started 
                in 60 seconds (with initialization)</strong> section.
            </p>
            <h3>Getting Started in 60 Seconds (without Initialization)</h3>
            <p>                
                To use the helper to display a Poll Widget, follow these steps:
            </p>
            <ol>
                <li>If you haven't got a Polldaddy account, signup for a <a href="http://polldaddy.com/signup-free/">free account</a>.</li>
                <li>Select the Polls option from the Polldaddy Home page, and create a new Poll (also, post some votes to the Poll).</li>
                <li>In any WebMatrix page, add the following line to display your Poll (replace the placeholder with the Id of your Poll):</li>
                <pre class="code">
@Polldaddy.GetPollWidget("{your-poll-id}")
</pre>
            </ol>
            <h3>
                Getting Started in 60 Seconds (with Initialization)</h3>
            <p>
                These steps will guide you on how to display the Poll results of a given Poll in your
                site:
            </p>
            <ol>
                <li>Click <a href="http://polldaddy.com/register/">here</a> to register for the Polldaddy API. Make note of the 
                Polldaddy API key.<br />
                    <img src="content/images/register-application.png" width="400px"
                        class="centeredImage withMargin" />
                </li>
                <li>If you haven't created a Poll yet, select the Polls option from the Polldaddy Home page, and create a new Poll (also, post some votes to the Poll).</li>
                <li>Add the following line to the <strong>_AppStart.cshtml</strong> page of your WebMatrix
                    site (if the file does not already exist, create it in the root of the website).
                    Replace the placeholder with your Polldaddy API key.
                    <pre class="code">@{
    Polldaddy.Initialize("{your-api-key}");    
}</pre>
                </li>
                <li>In any WebMatrix page, add the following code to display the results of your Poll (replace the placeholder 
                with the Id of your Poll):
                    <pre class="code">
@{
    var results = Polldaddy.GetPollResults("{your-poll-id}");
    var grid = new WebGrid(results);
}
...
@grid.GetHtml()
</pre>
                </li>
            </ol>
            <h3>Running the Bakery Sample</h3>                     
            <p>
                Optionally, you can download a sample WebMatrix web site based on the Bakery template, where you can see the helper in action. To download and run it with 
                Microsoft WebMatrix, follow these steps:
            </p>
            <ol>
                <li>Download the sample site from the helper's <a href="http://polldaddyhelper.codeplex.com">Codeplex</a> site, Download section. Extract the contents and open the folder in WebMatrix.</li>
                <li>Run the web site!</li>
            </ol>
            <h3>
                More Info</h3>
            <p>
                Don't miss the helper's <a href="http://www.youtube.com/watch?v=aTCKhQOAdN4">getting started screencast</a>.
            </p>
            <p>
                You can find more information about the Polldaddy API in <a href="http://support.polldaddy.com/api/">http://support.polldaddy.com/api/</a>.
            </p>
            <p>
                Learn more on WebMatrix, ASP.NET Web Pages and the Razor Syntax <a href="http://www.microsoft.com/web/webmatrix/learn/">
                    with the WebMatrix tutorials</a>.
            </p>
        </div>
        <ul class="footer">
            <li>Download more helpers from <a href="http://www.codeplex.com/site/search?TagName=WebMatrix%20Helpers">
                CodePlex</a>.</li>
            <li>&copy; 2010-2011 Microsoft Corporation. Powered by IIS Express.</li>
        </ul>
    </div>
</body>
</html>
